home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / CMApplication.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-06  |  27.7 KB  |  755 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CMApplication.h
  3.  
  4.      Contains:    Color Matching Interfaces
  5.  
  6.      Version:    Technology:    ColorSync 2.0
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __CMAPPLICATION__
  21. #define __CMAPPLICATION__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __QUICKDRAW__
  30. #include <Quickdraw.h>
  31. #endif
  32. /*    #include <MixedMode.h>                                        */
  33. /*    #include <QuickdrawText.h>                                    */
  34.  
  35. #ifndef __FILES__
  36. #include <Files.h>
  37. #endif
  38. /*    #include <OSUtils.h>                                        */
  39. /*        #include <Memory.h>                                        */
  40. /*    #include <Finder.h>                                            */
  41.  
  42. #ifndef __PRINTING__
  43. #include <Printing.h>
  44. #endif
  45. /*    #include <Errors.h>                                            */
  46. /*    #include <Dialogs.h>                                        */
  47. /*        #include <Menus.h>                                        */
  48. /*        #include <Controls.h>                                    */
  49. /*        #include <Windows.h>                                    */
  50. /*            #include <Events.h>                                    */
  51. /*        #include <TextEdit.h>                                    */
  52.  
  53. #ifndef __CMICCPROFILE__
  54. #include <CMICCProfile.h>
  55. #endif
  56.  
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif
  60.  
  61. #if PRAGMA_ALIGN_SUPPORTED
  62. #pragma options align=mac68k
  63. #endif
  64.  
  65. #if PRAGMA_IMPORT_SUPPORTED
  66. #pragma import on
  67. #endif
  68.  
  69.  
  70. enum {
  71.     gestaltColorSync20            = 0x0200
  72. };
  73.  
  74. enum {
  75.     kDefaultCMMSignature        = 'appl'
  76. };
  77.  
  78. /* Macintosh 68K trap word */
  79. enum {
  80.     cmTrap                        = 0xABEE
  81. };
  82.  
  83. /* PicComment IDs */
  84. enum {
  85.     cmBeginProfile                = 220,
  86.     cmEndProfile                = 221,
  87.     cmEnableMatching            = 222,
  88.     cmDisableMatching            = 223,
  89.     cmComment                    = 224
  90. };
  91.  
  92. /* PicComment selectors for cmComment */
  93. enum {
  94.     cmBeginProfileSel            = 0,
  95.     cmContinueProfileSel        = 1,
  96.     cmEndProfileSel                = 2
  97. };
  98.  
  99. /* Defines for version 1.0 CMProfileSearchRecord.fieldMask */
  100. enum {
  101.     cmMatchCMMType                = 0x00000001,
  102.     cmMatchApplProfileVersion    = 0x00000002,
  103.     cmMatchDataType                = 0x00000004,
  104.     cmMatchDeviceType            = 0x00000008,
  105.     cmMatchDeviceManufacturer    = 0x00000010,
  106.     cmMatchDeviceModel            = 0x00000020,
  107.     cmMatchDeviceAttributes        = 0x00000040,
  108.     cmMatchFlags                = 0x00000080,
  109.     cmMatchOptions                = 0x00000100,
  110.     cmMatchWhite                = 0x00000200,
  111.     cmMatchBlack                = 0x00000400
  112. };
  113.  
  114. /* Defines for version 2.0 CMSearchRecord.searchMask */
  115. enum {
  116.     cmMatchAnyProfile            = 0x00000000,
  117.     cmMatchProfileCMMType        = 0x00000001,
  118.     cmMatchProfileClass            = 0x00000002,
  119.     cmMatchDataColorSpace        = 0x00000004,
  120.     cmMatchProfileConnectionSpace = 0x00000008,
  121.     cmMatchManufacturer            = 0x00000010,
  122.     cmMatchModel                = 0x00000020,
  123.     cmMatchAttributes            = 0x00000040,
  124.     cmMatchProfileFlags            = 0x00000080
  125. };
  126.  
  127. /* Result codes */
  128. enum {
  129. /* General Errors */
  130.     cmProfileError                = -170,
  131.     cmMethodError                = -171,
  132.     cmMethodNotFound            = -175,                            /* CMM not present */
  133.     cmProfileNotFound            = -176,                            /* Responder error */
  134.     cmProfilesIdentical            = -177,                            /* Profiles the same */
  135.     cmCantConcatenateError        = -178,                            /* Profile can't be concatenated */
  136.     cmCantXYZ                    = -179,                            /* CMM cant handle XYZ space */
  137.     cmCantDeleteProfile            = -180,                            /* Responder error */
  138.     cmUnsupportedDataType        = -181,                            /* Responder error */
  139.     cmNoCurrentProfile            = -182,                            /* Responder error */
  140. /* Profile Access Errors */
  141.     cmElementTagNotFound        = -4200,
  142.     cmIndexRangeErr                = -4201,                        /* Index out of range */
  143.     cmCantDeleteElement            = -4202,
  144.     cmFatalProfileErr            = -4203,
  145.     cmInvalidProfile            = -4204,                        /* A Profile must contain a 'cs1 ' tag to be valid */
  146.     cmInvalidProfileLocation    = -4205,                        /* Operation not supported for this profile location */
  147. /* Profile Search Errors */
  148.     cmInvalidSearch                = -4206,                        /* Bad Search Handle */
  149.     cmSearchError                = -4207,
  150.     cmErrIncompatibleProfile    = -4208,
  151. /* Other ColorSync Errors */
  152.     cmInvalidColorSpace            = -4209,                        /* Profile colorspace does not match bitmap type */
  153.     cmInvalidSrcMap                = -4210,                        /* Source pix/bit map was invalid */
  154.     cmInvalidDstMap                = -4211,                        /* Destination pix/bit map was invalid */
  155.     cmNoGDevicesError            = -4212,                        /* Begin/End Matching -- no gdevices available */
  156.     cmInvalidProfileComment        = -4213,                        /* Bad Profile comment during drawpicture */
  157. /* Color Conversion Errors */
  158.     cmRangeOverFlow                = -4214,                        /* One or more output color value overflows in color conversion 
  159.                                                         all input color values will still be converted, and the overflown 
  160.                                                         will be clipped */
  161. /* Other Profile Access Errors */
  162.     cmCantCopyModifiedV1Profile    = -4215                            /* It is illegal to copy version 1 profiles that  
  163.                                                         have been modified */
  164. };
  165.  
  166. /* deviceType values for ColorSync 1.0 Device Profile access */
  167. enum {
  168.     cmSystemDevice                = 'sys ',
  169.     cmGDevice                    = 'gdev'
  170. };
  171.  
  172. /* Commands for CMFlattenUPP(…) */
  173. enum {
  174.     cmOpenReadSpool                = 1,
  175.     cmOpenWriteSpool,
  176.     cmReadSpool,
  177.     cmWriteSpool,
  178.     cmCloseSpool
  179. };
  180.  
  181. /* Flags for PostScript-related functions */
  182. enum {
  183.     cmPS7bit                    = 1,
  184.     cmPS8bit                    = 2
  185. };
  186.  
  187. typedef struct CMPrivateProfileRecord *CMProfileRef;
  188.  
  189. /* Abstract data type for Profile search result */
  190. typedef struct CMPrivateProfileSearchResult *CMProfileSearchRef;
  191.  
  192. /* Abstract data type for BeginMatching(…) reference */
  193. typedef struct CMPrivateMatchRefRecord *CMMatchRef;
  194.  
  195. /* Abstract data type for ColorWorld reference */
  196. typedef struct CMPrivateColorWorldRecord *CMWorldRef;
  197.  
  198. /* Caller-supplied progress function for Bitmap & PixMap matching routines */
  199. /* Caller-supplied filter function for Profile search */
  200. typedef pascal OSErr (*CMFlattenProcPtr)(long command, long *size, void *data, void *refCon);
  201. typedef pascal Boolean (*CMBitmapCallBackProcPtr)(long progress, void *refCon);
  202. typedef pascal Boolean (*CMProfileFilterProcPtr)(CMProfileRef prof, void *refCon);
  203.  
  204. #if GENERATINGCFM
  205. typedef UniversalProcPtr CMFlattenUPP;
  206. typedef UniversalProcPtr CMBitmapCallBackUPP;
  207. typedef UniversalProcPtr CMProfileFilterUPP;
  208. #else
  209. typedef CMFlattenProcPtr CMFlattenUPP;
  210. typedef CMBitmapCallBackProcPtr CMBitmapCallBackUPP;
  211. typedef CMProfileFilterProcPtr CMProfileFilterUPP;
  212. #endif
  213.  
  214. enum {
  215.     uppCMFlattenProcInfo = kPascalStackBased
  216.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  217.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  218.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long*)))
  219.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void*)))
  220.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))),
  221.     uppCMBitmapCallBackProcInfo = kPascalStackBased
  222.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  223.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  224.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*))),
  225.     uppCMProfileFilterProcInfo = kPascalStackBased
  226.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  227.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(CMProfileRef)))
  228.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  229. };
  230.  
  231. #if GENERATINGCFM
  232. #define NewCMFlattenProc(userRoutine)        \
  233.         (CMFlattenUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMFlattenProcInfo, GetCurrentArchitecture())
  234. #define NewCMBitmapCallBackProc(userRoutine)        \
  235.         (CMBitmapCallBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, GetCurrentArchitecture())
  236. #define NewCMProfileFilterProc(userRoutine)        \
  237.         (CMProfileFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileFilterProcInfo, GetCurrentArchitecture())
  238. #else
  239. #define NewCMFlattenProc(userRoutine)        \
  240.         ((CMFlattenUPP) (userRoutine))
  241. #define NewCMBitmapCallBackProc(userRoutine)        \
  242.         ((CMBitmapCallBackUPP) (userRoutine))
  243. #define NewCMProfileFilterProc(userRoutine)        \
  244.         ((CMProfileFilterUPP) (userRoutine))
  245. #endif
  246.  
  247. #if GENERATINGCFM
  248. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)        \
  249.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMFlattenProcInfo, (command), (size), (data), (refCon))
  250. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)        \
  251.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, (progress), (refCon))
  252. #define CallCMProfileFilterProc(userRoutine, prof, refCon)        \
  253.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMProfileFilterProcInfo, (prof), (refCon))
  254. #else
  255. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)        \
  256.         (*(userRoutine))((command), (size), (data), (refCon))
  257. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)        \
  258.         (*(userRoutine))((progress), (refCon))
  259. #define CallCMProfileFilterProc(userRoutine, prof, refCon)        \
  260.         (*(userRoutine))((prof), (refCon))
  261. #endif
  262.  
  263. typedef long CMError;
  264.  
  265. /* For 1.0 and 2.0 profile header variants */
  266. /* CMAppleProfileHeader */
  267. union CMAppleProfileHeader {
  268.     CMHeader                        cm1;
  269.     CM2Header                        cm2;
  270. };
  271. typedef union CMAppleProfileHeader CMAppleProfileHeader;
  272.  
  273. /* Param for CWConcatColorWorld(…) */
  274. struct CMConcatProfileSet {
  275.     unsigned short                    keyIndex;                    /* Zero-based */
  276.     unsigned short                    count;                        /* Min 1 */
  277.     CMProfileRef                    profileSet[1];                /* Variable. Ordered from Source -> Dest */
  278. };
  279. typedef struct CMConcatProfileSet CMConcatProfileSet;
  280.  
  281. /* ColorSync color data types */
  282. struct CMRGBColor {
  283.     unsigned short                    red;                        /* 0..65535 */
  284.     unsigned short                    green;
  285.     unsigned short                    blue;
  286. };
  287. typedef struct CMRGBColor CMRGBColor;
  288.  
  289. struct CMCMYKColor {
  290.     unsigned short                    cyan;                        /* 0..65535 */
  291.     unsigned short                    magenta;
  292.     unsigned short                    yellow;
  293.     unsigned short                    black;
  294. };
  295. typedef struct CMCMYKColor CMCMYKColor;
  296.  
  297. struct CMCMYColor {
  298.     unsigned short                    cyan;                        /* 0..65535 */
  299.     unsigned short                    magenta;
  300.     unsigned short                    yellow;
  301. };
  302. typedef struct CMCMYColor CMCMYColor;
  303.  
  304. struct CMHLSColor {
  305.     unsigned short                    hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  306.     unsigned short                    lightness;                    /* 0..65535 */
  307.     unsigned short                    saturation;                    /* 0..65535 */
  308. };
  309. typedef struct CMHLSColor CMHLSColor;
  310.  
  311. struct CMHSVColor {
  312.     unsigned short                    hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  313.     unsigned short                    saturation;                    /* 0..65535 */
  314.     unsigned short                    value;                        /* 0..65535 */
  315. };
  316. typedef struct CMHSVColor CMHSVColor;
  317.  
  318. struct CMLabColor {
  319.     unsigned short                    L;                            /* 0..65535 maps to 0..100 */
  320.     unsigned short                    a;                            /* 0..65535 maps to -128..127.996 */
  321.     unsigned short                    b;                            /* 0..65535 maps to -128..127.996 */
  322. };
  323. typedef struct CMLabColor CMLabColor;
  324.  
  325. struct CMLuvColor {
  326.     unsigned short                    L;                            /* 0..65535 maps to 0..100 */
  327.     unsigned short                    u;                            /* 0..65535 maps to -128..127.996 */
  328.     unsigned short                    v;                            /* 0..65535 maps to -128..127.996 */
  329. };
  330. typedef struct CMLuvColor CMLuvColor;
  331.  
  332. struct CMYxyColor {
  333.     unsigned short                    capY;                        /* 0..65535 maps to 0..1 */
  334.     unsigned short                    x;                            /* 0..65535 maps to 0..1 */
  335.     unsigned short                    y;                            /* 0..65535 maps to 0..1 */
  336. };
  337. typedef struct CMYxyColor CMYxyColor;
  338.  
  339. struct CMGrayColor {
  340.     unsigned short                    gray;                        /* 0..65535 */
  341. };
  342. typedef struct CMGrayColor CMGrayColor;
  343.  
  344. struct CMMultichannel5Color {
  345.     unsigned char                    components[5];                /* 0..255 */
  346. };
  347. typedef struct CMMultichannel5Color CMMultichannel5Color;
  348.  
  349. struct CMMultichannel6Color {
  350.     unsigned char                    components[6];                /* 0..255 */
  351. };
  352. typedef struct CMMultichannel6Color CMMultichannel6Color;
  353.  
  354. struct CMMultichannel7Color {
  355.     unsigned char                    components[7];                /* 0..255 */
  356. };
  357. typedef struct CMMultichannel7Color CMMultichannel7Color;
  358.  
  359. struct CMMultichannel8Color {
  360.     unsigned char                    components[8];                /* 0..255 */
  361. };
  362. typedef struct CMMultichannel8Color CMMultichannel8Color;
  363.  
  364. union CMColor {
  365.     CMRGBColor                        rgb;
  366.     CMHSVColor                        hsv;
  367.     CMHLSColor                        hls;
  368.     CMXYZColor                        XYZ;
  369.     CMLabColor                        Lab;
  370.     CMLuvColor                        Luv;
  371.     CMYxyColor                        Yxy;
  372.     CMCMYKColor                        cmyk;
  373.     CMCMYColor                        cmy;
  374.     CMGrayColor                        gray;
  375.     CMMultichannel5Color            mc5;
  376.     CMMultichannel6Color            mc6;
  377.     CMMultichannel7Color            mc7;
  378.     CMMultichannel8Color            mc8;
  379. };
  380. typedef union CMColor CMColor;
  381.  
  382. struct CMProfileSearchRecord {
  383.     CMHeader                        header;
  384.     unsigned long                    fieldMask;
  385.     unsigned long                    reserved[2];
  386. };
  387. typedef struct CMProfileSearchRecord CMProfileSearchRecord, **CMProfileSearchRecordHandle;
  388.  
  389. /* Search definition for 2.0 */
  390. struct CMSearchRecord {
  391.     OSType                            CMMType;
  392.     OSType                            profileClass;
  393.     OSType                            dataColorSpace;
  394.     OSType                            profileConnectionSpace;
  395.     unsigned long                    deviceManufacturer;
  396.     unsigned long                    deviceModel;
  397.     unsigned long                    deviceAttributes[2];
  398.     unsigned long                    profileFlags;
  399.     unsigned long                    searchMask;
  400.     CMProfileFilterUPP                filter;
  401. };
  402. typedef struct CMSearchRecord CMSearchRecord;
  403.  
  404. /* GetCWInfo structures */
  405. struct CMMInfoRecord {
  406.     OSType                            CMMType;
  407.     long                            CMMVersion;
  408. };
  409. typedef struct CMMInfoRecord CMMInfoRecord;
  410.  
  411. struct CMCWInfoRecord {
  412.     unsigned long                    cmmCount;
  413.     CMMInfoRecord                    cmmInfo[2];
  414. };
  415. typedef struct CMCWInfoRecord CMCWInfoRecord;
  416.  
  417.  
  418. enum {
  419.     cmNoColorPacking            = 0x0000,
  420.     cmAlphaSpace                = 0x0080,
  421.     cmWord5ColorPacking            = 0x0500,
  422.     cmLong8ColorPacking            = 0x0800,
  423.     cmLong10ColorPacking        = 0x0a00,
  424.     cmAlphaFirstPacking            = 0x1000,
  425.     cmOneBitDirectPacking        = 0x0b00
  426. };
  427.  
  428. enum {
  429.     cmNoSpace                    = 0,
  430.     cmRGBSpace,
  431.     cmCMYKSpace,
  432.     cmHSVSpace,
  433.     cmHLSSpace,
  434.     cmYXYSpace,
  435.     cmXYZSpace,
  436.     cmLUVSpace,
  437.     cmLABSpace,
  438.     cmReservedSpace1,
  439.     cmGraySpace,
  440.     cmReservedSpace2,
  441.     cmGamutResultSpace,
  442.     cmRGBASpace                    = cmRGBSpace + cmAlphaSpace,
  443.     cmGrayASpace                = cmGraySpace + cmAlphaSpace,
  444.     cmRGB16Space                = cmWord5ColorPacking + cmRGBSpace,
  445.     cmRGB32Space                = cmLong8ColorPacking + cmRGBSpace,
  446.     cmARGB32Space                = cmLong8ColorPacking + cmAlphaFirstPacking + cmRGBASpace,
  447.     cmCMYK32Space                = cmLong8ColorPacking + cmCMYKSpace,
  448.     cmHSV32Space                = cmLong10ColorPacking + cmHSVSpace,
  449.     cmHLS32Space                = cmLong10ColorPacking + cmHLSSpace,
  450.     cmYXY32Space                = cmLong10ColorPacking + cmYXYSpace,
  451.     cmXYZ32Space                = cmLong10ColorPacking + cmXYZSpace,
  452.     cmLUV32Space                = cmLong10ColorPacking + cmLUVSpace,
  453.     cmLAB32Space                = cmLong10ColorPacking + cmLABSpace,
  454.     cmGamutResult1Space            = cmOneBitDirectPacking + cmGamutResultSpace
  455. };
  456.  
  457. typedef unsigned long CMBitmapColorSpace;
  458.  
  459. struct CMBitmap {
  460.     char                            *image;
  461.     long                            width;
  462.     long                            height;
  463.     long                            rowBytes;
  464.     long                            pixelSize;
  465.     CMBitmapColorSpace                space;
  466.     long                            user1;
  467.     long                            user2;
  468. };
  469. typedef struct CMBitmap CMBitmap;
  470.  
  471. /* Classic Print Manager Stuff */
  472.  
  473. enum {
  474.     enableColorMatchingOp        = 12,
  475.     registerProfileOp            = 13
  476. };
  477.  
  478. /* PrGeneral parameter blocks */
  479. struct TEnableColorMatchingBlk {
  480.     short                            iOpCode;
  481.     short                            iError;
  482.     long                            lReserved;
  483.     THPrint                            hPrint;
  484.     Boolean                            fEnableIt;
  485.     SInt8                            filler;
  486. };
  487. typedef struct TEnableColorMatchingBlk TEnableColorMatchingBlk;
  488.  
  489. struct TRegisterProfileBlk {
  490.     short                            iOpCode;
  491.     short                            iError;
  492.     long                            lReserved;
  493.     THPrint                            hPrint;
  494.     Boolean                            fRegisterIt;
  495.     SInt8                            filler;
  496. };
  497. typedef struct TRegisterProfileBlk TRegisterProfileBlk;
  498.  
  499.  
  500. enum {
  501.     cmNoProfileBase                = 0,
  502.     cmFileBasedProfile            = 1,
  503.     cmHandleBasedProfile        = 2,
  504.     cmPtrBasedProfile            = 3
  505. };
  506.  
  507. struct CMFileLocation {
  508.     FSSpec                            spec;
  509. };
  510. typedef struct CMFileLocation CMFileLocation;
  511.  
  512. struct CMHandleLocation {
  513.     Handle                            h;
  514. };
  515. typedef struct CMHandleLocation CMHandleLocation;
  516.  
  517. struct CMPtrLocation {
  518.     Ptr                                p;
  519. };
  520. typedef struct CMPtrLocation CMPtrLocation;
  521.  
  522. union CMProfLoc {
  523.     CMFileLocation                    fileLoc;
  524.     CMHandleLocation                handleLoc;
  525.     CMPtrLocation                    ptrLoc;
  526. };
  527. typedef union CMProfLoc CMProfLoc;
  528.  
  529. struct CMProfileLocation {
  530.     short                            locType;
  531.     CMProfLoc                        u;
  532. };
  533. typedef struct CMProfileLocation CMProfileLocation;
  534.  
  535. /* Profile file and element access */
  536. extern pascal CMError CMOpenProfile(CMProfileRef *prof, const CMProfileLocation *theProfile)
  537.  FOURWORDINLINE(0x203C, 0x0008, 0x001C, 0xABEE);
  538. extern pascal CMError CMCloseProfile(CMProfileRef prof)
  539.  FOURWORDINLINE(0x203C, 0x0004, 0x001D, 0xABEE);
  540. extern pascal CMError CMUpdateProfile(CMProfileRef prof)
  541.  FOURWORDINLINE(0x203C, 0x0004, 0x0034, 0xABEE);
  542. extern pascal CMError CMNewProfile(CMProfileRef *prof, const CMProfileLocation *theProfile)
  543.  FOURWORDINLINE(0x203C, 0x0008, 0x001B, 0xABEE);
  544. extern pascal CMError CMCopyProfile(CMProfileRef *targetProf, const CMProfileLocation *targetLocation, CMProfileRef srcProf)
  545.  FOURWORDINLINE(0x203C, 0x000C, 0x0025, 0x0ABEE);
  546. extern pascal CMError CMGetProfileLocation(CMProfileRef prof, CMProfileLocation *theProfile)
  547.  FOURWORDINLINE(0x203C, 0x0008, 0x003C, 0x0ABEE);
  548. extern pascal CMError CMValidateProfile(CMProfileRef prof, Boolean *valid, Boolean *preferredCMMnotfound)
  549.  FOURWORDINLINE(0x203C, 0x000C, 0x0026, 0x0ABEE);
  550. extern pascal CMError CMFlattenProfile(CMProfileRef prof, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  551.  FOURWORDINLINE(0x203C, 0x0014, 0x0031, 0x0ABEE);
  552. extern pascal CMError CMUnflattenProfile(FSSpec *resultFileSpec, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  553.  FOURWORDINLINE(0x203C, 0x0010, 0x0032, 0x0ABEE);
  554. extern pascal CMError CMProfileElementExists(CMProfileRef prof, OSType tag, Boolean *found)
  555.  FOURWORDINLINE(0x203C, 0x000C, 0x001E, 0x0ABEE);
  556. extern pascal CMError CMCountProfileElements(CMProfileRef prof, unsigned long *elementCount)
  557.  FOURWORDINLINE(0x203C, 0x0008, 0x001F, 0x0ABEE);
  558. extern pascal CMError CMGetProfileElement(CMProfileRef prof, OSType tag, unsigned long *elementSize, void *elementData)
  559.  FOURWORDINLINE(0x203C, 0x0010, 0x0020, 0x0ABEE);
  560. extern pascal CMError CMGetProfileHeader(CMProfileRef prof, CMAppleProfileHeader *header)
  561.  FOURWORDINLINE(0x203C, 0x0008, 0x0039, 0x0ABEE);
  562. extern pascal CMError CMGetPartialProfileElement(CMProfileRef prof, OSType tag, unsigned long offset, unsigned long *byteCount, void *elementData)
  563.  FOURWORDINLINE(0x203C, 0x0014, 0x0036, 0x0ABEE);
  564. extern pascal CMError CMSetProfileElementSize(CMProfileRef prof, OSType tag, unsigned long elementSize)
  565.  FOURWORDINLINE(0x203C, 0x000C, 0x0038, 0x0ABEE);
  566. extern pascal CMError CMSetPartialProfileElement(CMProfileRef prof, OSType tag, unsigned long offset, unsigned long byteCount, void *elementData)
  567.  FOURWORDINLINE(0x203C, 0x0014, 0x0037, 0x0ABEE);
  568. extern pascal CMError CMGetIndProfileElementInfo(CMProfileRef prof, unsigned long index, OSType *tag, unsigned long *elementSize, Boolean *refs)
  569.  FOURWORDINLINE(0x203C, 0x0014, 0x0021, 0x0ABEE);
  570. extern pascal CMError CMGetIndProfileElement(CMProfileRef prof, unsigned long index, unsigned long *elementSize, void *elementData)
  571.  FOURWORDINLINE(0x203C, 0x0010, 0x0022, 0x0ABEE);
  572. extern pascal CMError CMSetProfileElement(CMProfileRef prof, OSType tag, unsigned long elementSize, void *elementData)
  573.  FOURWORDINLINE(0x203C, 0x0010, 0x0023, 0x0ABEE);
  574. extern pascal CMError CMSetProfileHeader(CMProfileRef prof, const CMAppleProfileHeader *header)
  575.  FOURWORDINLINE(0x203C, 0x0008, 0x003A, 0x0ABEE);
  576. extern pascal CMError CMSetProfileElementReference(CMProfileRef prof, OSType elementTag, OSType referenceTag)
  577.  FOURWORDINLINE(0x203C, 0x000C, 0x0035, 0x0ABEE);
  578. extern pascal CMError CMRemoveProfileElement(CMProfileRef prof, OSType tag)
  579.  FOURWORDINLINE(0x203C, 0x0008, 0x0024, 0x0ABEE);
  580. extern pascal CMError CMGetScriptProfileDescription(CMProfileRef prof, Str255 name, ScriptCode *code)
  581.  FOURWORDINLINE(0x203C, 0x000C, 0x003E, 0x0ABEE);
  582. /* Low-level matching functions */
  583. extern pascal CMError NCWNewColorWorld(CMWorldRef *cw, CMProfileRef src, CMProfileRef dst)
  584.  FOURWORDINLINE(0x203C, 0x000C, 0x0014, 0x0ABEE);
  585. extern pascal CMError CWConcatColorWorld(CMWorldRef *cw, CMConcatProfileSet *profileSet)
  586.  FOURWORDINLINE(0x203C, 0x0008, 0x0015, 0x0ABEE);
  587. extern pascal CMError CWNewLinkProfile(CMProfileRef *prof, const CMProfileLocation *targetLocation, CMConcatProfileSet *profileSet)
  588.  FOURWORDINLINE(0x203C, 0x000C, 0x0033, 0x0ABEE);
  589. extern pascal void CWDisposeColorWorld(CMWorldRef cw)
  590.  FOURWORDINLINE(0x203C, 0x0004, 0x0001, 0x0ABEE);
  591. extern pascal CMError CWMatchColors(CMWorldRef cw, CMColor *myColors, unsigned long count)
  592.  FOURWORDINLINE(0x203C, 0x000C, 0x0002, 0x0ABEE);
  593. extern pascal CMError CWCheckColors(CMWorldRef cw, CMColor *myColors, unsigned long count, long *result)
  594.  FOURWORDINLINE(0x203C, 0x0010, 0x0003, 0x0ABEE);
  595. /* Bitmap matching */
  596. extern pascal CMError CWMatchBitmap(CMWorldRef cw, CMBitmap *bitmap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *matchedBitmap)
  597.  FOURWORDINLINE(0x203C, 0x0010, 0x002C, 0x0ABEE);
  598. extern pascal CMError CWCheckBitmap(CMWorldRef cw, const CMBitmap *bitmap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *resultBitmap)
  599.  FOURWORDINLINE(0x203C, 0x0014, 0x002D, 0x0ABEE);
  600. /* Quickdraw-specific matching */
  601. extern pascal CMError CWMatchPixMap(CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon)
  602.  FOURWORDINLINE(0x203C, 0x0010, 0x0004, 0x0ABEE);
  603. extern pascal CMError CWCheckPixMap(CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon, BitMap *resultBitMap)
  604.  FOURWORDINLINE(0x203C, 0x0014, 0x0007, 0x0ABEE);
  605. extern pascal CMError NCMBeginMatching(CMProfileRef src, CMProfileRef dst, CMMatchRef *myRef)
  606.  FOURWORDINLINE(0x203C, 0x000C, 0x0016, 0x0ABEE);
  607. extern pascal void CMEndMatching(CMMatchRef myRef)
  608.  FOURWORDINLINE(0x203C, 0x0004, 0x000B, 0x0ABEE);
  609. extern pascal void NCMDrawMatchedPicture(PicHandle myPicture, CMProfileRef dst, Rect *myRect)
  610.  FOURWORDINLINE(0x203C, 0x000C, 0x0017, 0x0ABEE);
  611. extern pascal void CMEnableMatchingComment(Boolean enableIt)
  612.  FOURWORDINLINE(0x203C, 0x0002, 0x000D, 0x0ABEE);
  613. extern pascal CMError NCMUseProfileComment(CMProfileRef prof, unsigned long flags)
  614.  FOURWORDINLINE(0x203C, 0x0008, 0x003B, 0x0ABEE);
  615. /* System Profile access */
  616. extern pascal CMError CMGetSystemProfile(CMProfileRef *prof)
  617.  FOURWORDINLINE(0x203C, 0x0004, 0x0018, 0x0ABEE);
  618. extern pascal CMError CMSetSystemProfile(const FSSpec *profileFileSpec)
  619.  FOURWORDINLINE(0x203C, 0x0004, 0x0019, 0x0ABEE);
  620. /* External Profile Management */
  621. extern pascal CMError CMNewProfileSearch(CMSearchRecord *searchSpec, void *refCon, unsigned long *count, CMProfileSearchRef *searchResult)
  622.  FOURWORDINLINE(0x203C, 0x0010, 0x0027, 0x0ABEE);
  623. extern pascal CMError CMUpdateProfileSearch(CMProfileSearchRef search, void *refCon, unsigned long *count)
  624.  FOURWORDINLINE(0x203C, 0x000C, 0x0028, 0x0ABEE);
  625. extern pascal void CMDisposeProfileSearch(CMProfileSearchRef search)
  626.  FOURWORDINLINE(0x203C, 0x0004, 0x0029, 0x0ABEE);
  627. extern pascal CMError CMSearchGetIndProfile(CMProfileSearchRef search, unsigned long index, CMProfileRef *prof)
  628.  FOURWORDINLINE(0x203C, 0x000C, 0x002A, 0x0ABEE);
  629. extern pascal CMError CMSearchGetIndProfileFileSpec(CMProfileSearchRef search, unsigned long index, FSSpec *profileFile)
  630.  FOURWORDINLINE(0x203C, 0x000C, 0x002B, 0x0ABEE);
  631. /* Utilities */
  632. extern pascal CMError CMGetColorSyncFolderSpec(short vRefNum, Boolean createFolder, short *foundVRefNum, long *foundDirID)
  633.  FOURWORDINLINE(0x203C, 0x000C, 0x0011, 0x0ABEE);
  634. extern pascal CMError CMGetCWInfo(CMWorldRef cw, CMCWInfoRecord *info)
  635.  FOURWORDINLINE(0x203C, 0x000C, 0x001A, 0x0ABEE);
  636. /* PS-related */
  637. extern pascal CMError CMGetPS2ColorSpace(CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  638.  FOURWORDINLINE(0x203C, 0x0014, 0x002E, 0x0ABEE);
  639. extern pascal CMError CMGetPS2ColorRenderingIntent(CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  640.  FOURWORDINLINE(0x203C, 0x0014, 0x002F, 0x0ABEE);
  641. extern pascal CMError CMGetPS2ColorRendering(CMProfileRef srcProf, CMProfileRef dstProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  642.  FOURWORDINLINE(0x203C, 0x0018, 0x0030, 0x0ABEE);
  643. extern pascal CMError CMGetPS2ColorRenderingVMSize(CMProfileRef srcProf, CMProfileRef dstProf, unsigned long *vmSize, Boolean *preferredCMMnotfound)
  644.  FOURWORDINLINE(0x203C, 0x0010, 0x003D, 0x0ABEE);
  645. /* ColorSync 1.0 functions which have parallel 2.0 counterparts */
  646. extern pascal CMError CWNewColorWorld(CMWorldRef *cw, CMProfileHandle src, CMProfileHandle dst)
  647.  FOURWORDINLINE(0x203C, 0x000C, 0x0000, 0x0ABEE);
  648. extern pascal CMError ConcatenateProfiles(CMProfileHandle thru, CMProfileHandle dst, CMProfileHandle *newDst)
  649.  FOURWORDINLINE(0x203C, 0x000C, 0x000C, 0x0ABEE);
  650. extern pascal CMError CMBeginMatching(CMProfileHandle src, CMProfileHandle dst, CMMatchRef *myRef)
  651.  FOURWORDINLINE(0x203C, 0x000C, 0x000A, 0x0ABEE);
  652. extern pascal void CMDrawMatchedPicture(PicHandle myPicture, CMProfileHandle dst, Rect *myRect)
  653.  FOURWORDINLINE(0x203C, 0x000C, 0x0009, 0x0ABEE);
  654. extern pascal CMError CMUseProfileComment(CMProfileHandle profile)
  655.  FOURWORDINLINE(0x203C, 0x0004, 0x0008, 0x0ABEE);
  656. extern pascal void CMGetProfileName(CMProfileHandle myProfile, CMIString *IStringResult)
  657.  FOURWORDINLINE(0x203C, 0x0008, 0x000E, 0x0ABEE);
  658. extern pascal long CMGetProfileAdditionalDataOffset(CMProfileHandle myProfile)
  659.  FOURWORDINLINE(0x203C, 0x0004, 0x000F, 0x0ABEE);
  660. /* ProfileResponder functions */
  661. extern pascal CMError GetProfile(OSType deviceType, long refNum, CMProfileHandle aProfile, CMProfileHandle *returnedProfile)
  662.  FOURWORDINLINE(0x203C, 0x0010, 0x0005, 0x0ABEE);
  663. extern pascal CMError SetProfile(OSType deviceType, long refNum, CMProfileHandle newProfile)
  664.  FOURWORDINLINE(0x203C, 0x000C, 0x0006, 0x0ABEE);
  665. extern pascal CMError SetProfileDescription(OSType deviceType, long refNum, long deviceData, CMProfileHandle hProfile)
  666.  FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0x0ABEE);
  667. extern pascal CMError GetIndexedProfile(OSType deviceType, long refNum, CMProfileSearchRecordHandle search, CMProfileHandle *returnProfile, long *index)
  668.  FOURWORDINLINE(0x203C, 0x0014, 0x0012, 0x0ABEE);
  669. extern pascal CMError DeleteDeviceProfile(OSType deviceType, long refNum, CMProfileHandle deleteMe)
  670.  FOURWORDINLINE(0x203C, 0x000C, 0x0013, 0x0ABEE);
  671. #if OLDROUTINENAMES
  672. typedef CMFlattenProcPtr CMFlattenProc;
  673.  
  674. typedef CMBitmapCallBackProcPtr CMBitmapCallBackProc;
  675.  
  676. typedef CMProfileFilterProcPtr CMProfileFilterProc;
  677.  
  678.  
  679. enum {
  680.     CMTrap                        = cmTrap,
  681.     CMBeginProfile                = cmBeginProfile,
  682.     CMEndProfile                = cmEndProfile,
  683.     CMEnableMatching            = cmEnableMatching,
  684.     CMDisableMatching            = cmDisableMatching
  685. };
  686.  
  687. /* 1.0 Error codes, for compatibility with older applications. 1.0 CMM's may return obsolete error codes */
  688. enum {
  689.     CMNoError                    = 0,                            /*    obsolete name, use noErr */
  690.     CMProfileError                = cmProfileError,
  691.     CMMethodError                = cmMethodError,
  692.     CMMemFullError                = -172,                            /*    obsolete, 2.0 uses memFullErr */
  693.     CMUnimplementedError        = -173,                            /*    obsolete, 2.0 uses unimpErr */
  694.     CMParamError                = -174,                            /*    obsolete, 2.0 uses paramErr */
  695.     CMMethodNotFound            = cmMethodNotFound,
  696.     CMProfileNotFound            = cmProfileNotFound,
  697.     CMProfilesIdentical            = cmProfilesIdentical,
  698.     CMCantConcatenateError        = cmCantConcatenateError,
  699.     CMCantXYZ                    = cmCantXYZ,
  700.     CMCantDeleteProfile            = cmCantDeleteProfile,
  701.     CMUnsupportedDataType        = cmUnsupportedDataType,
  702.     CMNoCurrentProfile            = cmNoCurrentProfile
  703. };
  704.  
  705. enum {
  706.     qdSystemDevice                = cmSystemDevice,
  707.     qdGDevice                    = cmGDevice
  708. };
  709.  
  710. enum {
  711.     kMatchCMMType                = cmMatchCMMType,
  712.     kMatchApplProfileVersion    = cmMatchApplProfileVersion,
  713.     kMatchDataType                = cmMatchDataType,
  714.     kMatchDeviceType            = cmMatchDeviceType,
  715.     kMatchDeviceManufacturer    = cmMatchDeviceManufacturer,
  716.     kMatchDeviceModel            = cmMatchDeviceModel,
  717.     kMatchDeviceAttributes        = cmMatchDeviceAttributes,
  718.     kMatchFlags                    = cmMatchFlags,
  719.     kMatchOptions                = cmMatchOptions,
  720.     kMatchWhite                    = cmMatchWhite,
  721.     kMatchBlack                    = cmMatchBlack
  722. };
  723.  
  724. /* types */
  725. typedef struct CMCMYKColor CMYKColor;
  726.  
  727. typedef CMWorldRef CWorld;
  728.  
  729. typedef long *CMGamutResult;
  730.  
  731. /* functions */
  732. #define EndMatching(myRef) CMEndMatching(myRef)
  733. #define EnableMatching(enableIt) CMEnableMatchingComment(enableIt)
  734. #define GetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID) CMGetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID)
  735. #define BeginMatching(src, dst, myRef) CMBeginMatching(src, dst, myRef)
  736. #define DrawMatchedPicture(myPicture, dst, myRect) CMDrawMatchedPicture(myPicture, dst, myRect)
  737. #define UseProfile(profile) CMUseProfileComment(profile)
  738. #define GetProfileName(myProfile, IStringResult) CMGetProfileName(myProfile, IStringResult)
  739. #define GetProfileAdditionalDataOffset(myProfile) CMGetProfileAdditionalDataOffset(myProfile)
  740. #endif
  741.  
  742. #if PRAGMA_IMPORT_SUPPORTED
  743. #pragma import off
  744. #endif
  745.  
  746. #if PRAGMA_ALIGN_SUPPORTED
  747. #pragma options align=reset
  748. #endif
  749.  
  750. #ifdef __cplusplus
  751. }
  752. #endif
  753.  
  754. #endif /* __CMAPPLICATION__ */
  755.